import request from '@/utils/request'
import qs from 'qs'

export function login(data) {
  return request({
    url: '/auth/login',
    method: 'post',
    data: data
  })
}
export function weChatScanLogin(data) {
  return request({
    url: '/auth/weChatScanLogin',
    method: 'post',
    data: data
  })
}
export function getCodeStatus(data) {
  return request({
    url: '/system/config/smsEnabled',
    method: 'get',
    data: data
  })
}
export function sendPhoneCode(data) {
  return request({
    url: '/resource/sms/sendPhoneCode',
    method: 'post',
    data: data
  })
}

export function checkCode(data) {
  return request({
    url: '/auth/checkCode',
    method: 'post',
    data: data
  })
}
export function checkAuthCode(data) {
  return request({
    url: '/system/company/auth/checkAuthCode',
    method: 'post',
    data: data
  })
}

export function loginByTelephone(data) {
  return request({
    url: '/auth/loginByTelephone',
    method: 'post',
    data: data
  })
}
export function register(data) {
  return request({
    url: '/auth/register',
    method: 'post',
    data: data
  })
}

/**
 * @Author wssn
 * @Description 获取最新的公告
 * @Date 24/4/2023 9:38 am
 */
export function getLastNotice(data) {
  return request({
    url: '/system/message/latest',
    method: 'post',
    data: data
  })
}

export function getInfo() {
  return request({
    url: '/system/user/getInfo',
    method: 'get'
  })
}
export function getRouters() {
  return request({
    url: '/system/menu/getRouters',
    method: 'get'
  })
}

export function getPublicKey() {
  return request({
    url: '/systemSet/systemSet/getPublicKey',
    method: 'post',
    data: ''
  })
}

export function logout() {
  return Promise.resolve()
}

export function getAuthMenu(data) {
  return request({
    url: '/menu/getMenus',
    method: 'post',
    data: qs.stringify(data)
  })
}
export function auth() {
  return request({
    url: '/system/company/auth',
    method: 'post',
    data: ''
  })
}
export function loginV2(data) {
  return request({
    url: '/auth/loginV2',
    method: 'post',
    data: data
  })
}
